home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Speccy ClassiX 1998
/
Speccy ClassiX 98.iso
/
amiga_system
/
the_aminet
/
comm
/
bbs
/
tatrivia15.lha
/
rexx
/
tatrivia.trans
Wrap
Text File
|
1995-10-15
|
13KB
|
430 lines
/* $VER: TA-Trivia v1.5 (10/11/95) for TransAmiga by John Kratz
Fidonet 1:260/322.0, Internet jkratz@erc.cat.syr.edu
*/
options results
signal on syntax
signal on error
signal on ioerr
/*************************************************************************/
/* Sysop Configurable variables */
oneright=0 /* Number of minutes to add for 1 right answers */
tworight=0 /* Number of minutes to add for 2 right answers */
threeright=0 /* Number of minutes to add for 3 right answers */
fourright=5 /* Number of minutes to add for 4 right answers */
fiveright=5 /* Number of minutes to add for 5 right answers */
sixright=5 /* Number of minutes to add for 6 right answers */
sevenright=5 /* Number of minutes to add for 7 right answers */
eightright=10 /* Number of minutes to add for 8 right answers */
nineright=20 /* Number of minutes to add for 9 right answers */
tenright=30 /* Number of minutes to add for 10 right answers */
/* Make sure this matches the # question files */
total=304 /* total number of question files available */
/*************************************************************************/
ui=userinfo;tr=transmit;gc=getchar;ss=sendstring;si=systeminfo
ui a;handle=result
ui a;name=result
ui o;access=result
si m;timeallowed=(result-3)
bbsidentify 'name';bbsname=result
ver="
TA
Trivia
v1.5"
bbsidentify 'sysop';sysopname=result
userinfo x ; ansi=result
CSI = '1b'x||'['
CRLF = '0d'x||'0a'x
FF = '0c'x
if ansi='ON' then do
OFF = CSI'0m' ; BO = CSI'1m' ; UL = CSI'4m' ; IT = CSI'3m'
RED = CSI'31m' ; GREEN = CSI'32m' ; YELLOW = CSI'33m' ; BLUE = CSI'34m'
PURPLE = CSI'35m' ; CYAN = CSI'36m' ; WHITE = CSI'37m'
YELLOWBACK = CSI'43m'
end
else do
OFF = '' ; BO = '' ; UL = '' ; IT = ''
RED = '' ; GREEN = '' ; YELLOW = '' ; BLUE = ''
PURPLE = '' ; CYAN = '' ; WHITE = ''
YELLOWBACK = ''
end
Highscores="BBS:Extras/TATRIVIA/Highscores.txt"
c=0
setnodelocation "Playing the Trivia game!"
sysoplog name 'played the Trivia Game!'
path='BBS:Extras/TaTrivia/'
upath=path"users/"
qpath=path"Questions/"
quest="Questions"
high= path"HighScores.txt"
index=1
check=1
used.1=0
START:
INST:
cls
ss GREEN
tr GREEN BO'TransAmiga Trivia Quizzer by' CYAN 'John Kratz.'GREEN
tr ''
tr 'The program will choose randomly among the' YELLOW total RED'trivia quizzes.'
tr ''
tr CYAN'Use the numbers
1
,
2
,
3
and
4
to select your answer.'
tr ''
tr 'You may quit at any time by typing
Q
.'
tr ''
address command 'WAIT 2 secs'
TITLESCREEN:
cls
tr ''
tr 'C
________________________ ______________________'
tr ' /C//C/'
tr ' /C//C/'
tr ' /__________C________//________C________/'
tr 'C/ /C/ /'
tr 'C/ /C/ /'
tr 'C/ /C/ /'
tr 'C
/ / ___C/ / ________ ___ __ ___ ___ ___'
tr 'C/ / / |C/ / / _ / / / | | / / / / / |'
tr 'C/ / / |C/ / / // / / / | | / / / / / |'
tr 'C/ / / | |C/ / / // / / / | |/ / / / / | |'
tr 'C/ / / /| |C/ / /C_/ / / | | / / / / /| |'
tr '
/ / / __ |C/ / / / | / /C| / / / / __ |'
tr ' / / / / | |C/ / / /| | / /C| / / / / / | |'
tr ' /____/ /__/ |__|C/____/ /___/ |__| /__/C|__/ /__/ /__/ |__|'
tr 'C
By
John Kratz of Amiga Time BBS!'
tr 'C
Internet
:
jkratz@erc.cat.syr.edu'
tr 'C
Fidonet
:
1:260/322.0'
tr 'C
Version
:
'ver'
'
bufferflush
tr ''
MAIN:
tr 'C
[
V
]
iew High Scores
[
P
]
lay TA Trivia'
if access > 200 then tr 'C
[
R
]
eset HighScores'
tr 'C
[
Q
]
uit
[
I
]
nstructions - How to Play'
ss 'C
Your Choice?
' ; gc ;ans=upper(ans) ; call GCCHECK
if ans='P' then do
cls
call STARTOVER
end
if ans='V' then do
cls
call SHOWHIGHS
continue
call TITLESCREEN
end
if ans='I' then do
cls
sendfile 'BBS:Extras/TATrivia/TATRIVIA.DOC'
continue
end
if access >= 200 & ans='R' then do
cls
call RESET
end
if ans='T' then do
cls
systeminfo m ; timeleft = Result
systeminfo q ; daily = Result
userinfo u ; onlinetime = Result
tr BO YELLOW'Your total online time per day is 'CYAN daily YELLOW' minutes!'
tr ' You have been online 'RED onlinetime YELLOW' minutes so far today!'
tr ' You have 'GREEN timeleft YELLOW' minutes left for today!'OFF
continue
call TITLESCREEN
end
if ans='Q' then signal QUIT
if ans='RESULT' then cls ; signal TITLESCREEN
STARTOVER:
num=1;count=1
score=0
timenumb=0
listnum=random(1,total,66)
GETQUESTIONS:
listnum=random(1,total,time('s'))
do i=1 to check
if used.i=listnum then signal GETQUESTIONS
end
used.index=listnum
check=index
index=index+1
if index=276 then do
do i=1 to check
used.i=0
end
index=1
check=1
end
if open('file',qpath||quest||listnum,'R') then do
do until EOF('file')
quest.num=readln('file')
do i=1 to 4
quest.num.i=readln('file')
end
num=num+1
end
call close('file')
end
else do
tr "There has been a problem loading the question file"
exit 10
end
SHOW:
cls
if count=num-1 then signal SHUTDOWN
tr ""
tr ""
ss ''YELLOWBACK BLUE bbsname"'s "RED"Trivia Quiz "OFF
tr " "
tr " "
if access >= 200 then do
ss ''BO GREEN"Question File number:"RED listnum
end
tr GREEN" Question number:"RED count
tr " "
tr CYAN quest.count YELLOW
tr ""
do i=1 to 4
parse var quest.count.i isans 2 answer
if isans="!" then theans=i
if isans~="-" then transmit '' i'' answer
end
bufferflush
tr ''
tr RED" You have "CYAN score RED" right."
tr ''
ss OFF PURPLE"Your Choice -> " CYAN ; gc
ASKIT:
guess=upper(result)
tr CYAN guess
if guess="1" then signal CONTINUE
if guess="2" then signal CONTINUE
if guess="3" & if isans~="-" then signal CONTINUE
if guess="4" & if isans~="-" then signal CONTINUE
if guess="Q" then signal SHUTDOWN
if guess="RESULT" then SIGNAL MAIN2
if guess="q" then do
guess=upper(guess)
signal SHUTDOWN
end
if guess~= "1" or guess ~= "2" or guess ~= "3" or guess ~= "4" or guess ~= "RESULT" then SIGNAL MAIN2
if guess="###PANIC" then signal exit 10
if guess="###panic" then signal exit 10
signal ASKIT
MAIN2:
Query PURPLE"FYour Choice ->
"
signal ASKIT
CONTINUE:
if guess=theans then do
score=score+1
tr CYAN" Correct."
end
else tr RED" Sorry, that's wrong."
address command 'WAIT 1 secs'
count=count+1
if count > num then do
if guess=theans then do
tr CYAN"Correct."
end
else tr RED"Sorry, that's wrong."
address command 'WAIT 1 secs'
signal SHUTDOWN
end
signal SHOW
GCCHECK:
ans=result
if ans ='###PANIC' then do ; bufferflush ; exit 10 ; end
return
SHOWHIGHS:
call READHIGH
call SHOWFIVE
return
CHECKHI:
call READHIGH
x=0 ; gp=c ; if gp <= 0 then signal L288
L276:
x=x+1 ; if x > 10 then signal L288
z=10 ; if zp.x.2=0 then signal L283
if gp < zp.x.2 then signal L276
L283:
z1=z-1
do y=1 to 3
zp.z.y=zp.z1.y
end y
z=z-1 ; if z~ < x then signal L283
zp.x.1=handle ; zp.x.2=gp ;zp.x.3=date()
tr "
Congratulations! You Are One Of The Top 10 Players!"
call open(f1,HIGHSCORES,'w')
do x=1 to 10
do y=1 to 3
call writeln(f1,zp.x.y)
end y
end x ; call close(f1)
if gs=0 then cls ; call SHOWHIGHS
bufferflush ; Address command 'Wait 2 secs'
return
L288:
timenumb=0
c=0
tr CYAN center("Sorry, You did not make it into the "GREEN"Top Ten"CYAN". Try Again Next Time.",100)
if count > 9 & score = 0 then signal ZERO
SIGNAL ANOTHER
return
READHIGH:
if ~exists(HighScores) then do
call open(f1,HighScores,'w')
do x=1 to 10
call writeln(f1,"Nobody Yet!") ; call writeln(f1,"0") ; call writeln(f1,"None Yet!!!")
end x ; call close(f1)
end
call open(f1,HighScores,'r')
do x=1 to 10
do y=1 to 3
zp.x.y=readln(f1)
end y
end x ; call close(f1)
return
ZERO:
newtime = ontime - 15
settime newtime
tr 'C
╔════════════════════════════════════════════════════╗'
tr 'C║ ▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄ ▄▄▄▄▄▄▄▄ ║'
tr 'C║ / █ █ ▌ █ █ ║'
tr 'C║ / █ █ ▌ █ █ ║'
tr 'C║ / █▄▄▄▄ █▄▄▄▄▄▄▌ █ █ ║'
tr 'C║ / █ █ \ █ █ ║'
tr 'C║ / █ █ \ █ █ ║'
tr 'C║ / █ █ \ █ █ ║'
tr 'C║ ▀▀▀▀▀▀▀ ▀▀▀▀▀▀▀ ▀ \ ▀▀▀▀▀▀▀▀ ║'
tr 'C║ ║'
tr 'C║ ▄▄▄▄▄▄▄ ▄▄▄▄▄ ▄▄▄▄▄▄▄▄ ▄ ▄ ▄▄▄▄▄▄▄▄ ║'
tr 'C║ █ ▌ █ █ █ █ █ ║'
tr 'C║ █ ▌ █ █ █ █ █ ║'
tr 'C║ █▄▄▄▄▄▄▌ █ █ █▄▄▄▄▄▄█ █ ║'
tr 'C║ █ \ █ █ ▄▄▄▄▄▄ █ █ █ ║'
tr 'C║ █ \ █ █ █ █ █ █ ║'
tr 'C║ █ \ █ █ █ █ █ █ ║'
tr 'C║ ▀ \ ▀▀▀▀▀ ▀▀▀▀▀▀▀▀ ▀ ▀ ▀ ║'
tr 'C╠════════════════════════════════════════════════════╣'
tr 'C║You
lose 15 minutes
for not getting atleast 1 right!║'
tr 'C╚════════════════════════════════════════════════════╝'
address command 'WAIT 2 secs'
return
SHOWFIVE:
tr '
╔════════════════════════════════════════════════════╗'
tr ' ║ TA
Trivia
High Scores!
║'
tr ' ║
Current Top
Ten
TA
Trivia
Champs:C
║'
tr ' ║C║'
tr ' ║ NAMEC
TOTAL SCORE!C
DATEC
║'
tr ' ║C║'
do x=1 to 10
tr ' ║'right('<'||x||'>',4)'
'||left(zp.x.1' ',20)'
'right(zp.x.2,2)' C
'right(zp.x.3,11)'
║'
end x
tr ' ║C║'
tr ' ╚════════════════════════════════════════════════════╝'
return
SHUTDOWN:
give=0
si m ; ontime=result
si q ; maxtime=result
if count > 9 & score < 3 then SIGNAL L288
if count > 9 & score > 3 then do
if score=4 then do
newtime = ontime + fourright
settime newtime
timenumb=fourright
c=4
end
if score=5 then do
newtime = ontime + fiveright
settime newtime
timenumb=fiveright
c=5
end
if score=6 then do
newtime = ontime + sixright
settime newtime
timenumb=sixright
c=6
end
if score=7 then do
newtime = ontime + sevenright
settime newtime
timenumb=sevenright
c=7
end
if score=8 then do
newtime = ontime + eightright
settime newtime
timenumb=eightright
c=8
end
if score=9 then do
newtime = ontime + nineright
settime newtime
timenumb=nineright
c=9
end
if score=10 then do
newtime = ontime + tenright
settime newtime
timenumb=tenright
c=10
end
end
if count > 9 & score > 3 then tr GREEN"You have been given "timenumb" extra minutes online for your "score" correct answers."
if timenumb > 0 then do
si m ; ontime=result
si q ; maxtime=result
setnewtime = ontime + timenumb
tr 'Your OLD time remaining is:' ontime 'minutes'
tr 'Your New time remaining is:' setnewtime 'minutes'
if setnewtime > maxtime then do
setnewtime = maxtime
tr 'Sorry, you can only have 'maxtime 'minutes/day total'
end
continue
settime setnewtime
end
give=1
SIGNAL CHECKHI
if give=0 then ss
ANOTHER:
ss YELLOW"Would you like to try another quiz? "CYAN"("GREEN"y"CYAN"/"RED"N"CYAN") "GREEN;gc;again=upper(result)
if again="Y" then do tr "Yes"; signal STARTOVER ; end
tr ""
tr GREEN"Returning you to "bbsname"."
cls
exit 10
RESET:
address command 'delete BBS:Extras/TATRIVIA/Highscores.txt'
Call TITLESCREEN
end
QUIT:
cls
Tr 'Thank you' name 'for playing TA Trivia!'
bufferflush ; exit 10
IOERR:
tr ''
tr '*BOOM* Got an IO error. Please notify 'sysop'!'
SYSOPLOG '*BOOM* Got an IO error in TA Trivia.'
SYSOPLOG '---> Line: ' SIGL
BUFFERFLUSH
EXIT 10
ERROR:
tr ''
tr '*BOOM* Got an error. Please notify 'sysop'!'
tr 'line: ' SIGL ' Severity: ' RC
SYSOPLOG '*BOOM* Got an error in TA Trivia..'
SYSOPLOG '---> Line: ' SIGL ' Severity: ' RC
BUFFERFLUSH
EXIT 10
SYNTAX:
tr 'Error in 'ver'. Line: 'SIGL
tr 'Error: 'RCALL errortext(RC)
tr 'Please notify 'sysopname'!'
tr 'Returning to 'BBSname'...'
SYSOPLOG 'Error in 'ver'. Line: 'SIGL
SYSOPLOG 'Error: 'RCALL errortext(RC)
BUFFERFLUSH
EXIT 10